package com.qianfeng.xinyihezi.xinyihezi.application;

import android.app.Application;

import com.activeandroid.ActiveAndroid;
import com.activeandroid.Configuration;
import com.qianfeng.xinyihezi.xinyihezi.model.ADBean;
import com.qianfeng.xinyihezi.xinyihezi.model.MyJson;
import com.qianfeng.xinyihezi.xinyihezi.model.bean_meng.Address;

/**
 * 作者：王加威 on 2016/11/13 14:47
 */

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Configuration config = new Configuration.Builder(this)
                .addModelClass(ADBean.class)
                //设置数据库的名字
                .setDatabaseName("XYHZ.db")
                // 设置数据库的版本
                .setDatabaseVersion(1)
                .create();
        Configuration config1 = new Configuration.Builder(this)
                .addModelClass(MyJson.class)
                //设置数据库的名字
                .setDatabaseName("XYHZ.db")
                // 设置数据库的版本
                .setDatabaseVersion(1)
                .create();
        ActiveAndroid.initialize(config);
        ActiveAndroid.initialize(config1);
        ActiveAndroid.initialize(new Configuration.Builder(this)
                .addModelClass(Address.class)
                .setDatabaseName("XINYI.db")
                .setDatabaseVersion(1)
                .create());
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        ActiveAndroid.dispose();
    }
}
